﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ITSSP.Views.ChangePassword
{
	public partial class MessageWindow : ChildWindow
	{
		public enum DialogSymbol
		{
			Success, CriticalError
		}

		public MessageWindow(string title = null, string text = null, DialogSymbol? symbol = null)
		{
			InitializeComponent();

			this.Title = title;
			this.Text = text;
			this.Symbol = symbol;
		}

		new public string Title
		{
			get { return base.Title.ToString(); }
			set { if (value != null) base.Title = value; }
		}

		public string Text
		{
			get { return this.Label1.Content.ToString(); }
			set { if (value != null) this.Label1.Content = value; }
		}

		public DialogSymbol? Symbol
		{
			set
			{
				this.CriticalErrorImage.Visibility = System.Windows.Visibility.Collapsed;
				this.SuccessImage.Visibility = System.Windows.Visibility.Collapsed;

				switch (value) {
					case DialogSymbol.CriticalError:
						this.CriticalErrorImage.Visibility = System.Windows.Visibility.Visible;
						break;
					case DialogSymbol.Success:
						this.SuccessImage.Visibility = System.Windows.Visibility.Visible;
						break;
				}
			}
		}

		public bool OkVisible
		{
			get { return this.OkButton.Visibility == System.Windows.Visibility.Visible; }
			set { this.OkButton.Visibility = value ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; }
		}
		
		private void OKButton_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = true;
		}
	}
}

